<?php
include('../../__global.php');

class aj_delCollection extends ml_controller {

    private $uid;
    private $col_id;


    function initParam() {

        $this->col_id = $this->input('col_id');
        $this->uid    = $this->__visitor['uid'];
    }

    function checkParam() {

        $this->check_referer();
        if ($this->check_permission(ML_PERMISSION_LOGOUT_ONLY)) {
            $this->api_output(ML_RCODE_NOLOGIN);
        }

        if ($this->check_permission(ML_PERMISSION_UNVERIFY_ONLY)) {
            $this->api_output(ML_RCODE_NOACTIVE);
        }

        if (!ml_tool_isuid::is_mluid($this->uid)) {
            $this->api_output(ML_RCODE_PARAM,'','wrong uid');
        }

    }

    public function main() {

        $model=new ml_model_dbCollectionBox();
        $rs=$model->delCollection($this->uid, $this->col_id);
        if(!$rs){
            $this->api_output(ML_RCODE_FAIL,'','fail');
        }
        else{
            $this->api_output(ML_RCODE_SUCC);

        }
    }

}

new aj_delCollection();